#include <bits/stdc++.h>
// 2025/01/23
// tag: 
// Author: Zhang Muen
using namespace std;

int n, a, b, k[201];
bool vis[201];

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> a >> b;
    for (int i = 1; i <= n; i++)
        cin >> k[i];
    queue<int> q;
    q.push(a);
    int cnt = 0;
    vis[a] = true;
    while (!q.empty())
    {
        int len = q.size();
        for (int i = 1; i <= len; i++){
            int x = q.front();
            q.pop();
            if (x == b){
                cout << cnt;
                return 0;
            }
            if (x + k[x] <= n && !vis[x + k[x]])
                q.push(x + k[x]), vis[x + k[x]] = true;
            if (x - k[x] >= 1 && !vis[x - k[x]])
                q.push(x - k[x]), vis[x - k[x]] = true;
        }
        cnt++;
    }
    cout << -1;
    return 0;
}